{% extends 'home.html' %}
{% block content_main %}
    <button class="btn btn-danger" id="btn1" value="1">提交
    </button>
    <script>

        $("#btn1").click(function () {
            let id = $('#btn1').val();
            swal({
                title: "确定要删除吗？",
                icon: "warning",
                buttons: ['取消', '确定'],
                dangerMode: true,
            })
                .then((willDelete) => {
                    if (willDelete) {
                        $.ajax({
                            url: "",  // 替换成实际的删除数据的 URL
                            method: "POST",
                            data: {
                                'id': id, 'action': 'del'
                            },
                            success: function (data) {
                                swal("这条数据已删除", {
                                    icon: "success",
                                });
                            }
                        });
                    }
                });
        })
    </script>




{% endblock %}